User Management
Manage users directly from the SDK.
SDK 3.0 requires Client side API key to be set using OVS_CMD_SET_API_DOMAIN method. The Client-side API key can be configured to enable Account Management permission using the management panel. If enabled, you can also:
- Enable AddClient requests from the client-side
- Enable ResetPassword requests from the client-side
Add Client
Add a new client on the back-end, including a new product.
Using Add Client on existing users will result in an error. Please use 'New Product' instead.
The AddClient endpoint is rate-limited for 1 client per 10 seconds unless it is sent from a whitelisted IP address
Login required: No
CmdProc Code: OVS_CMD_ADD_CLIENT
Command number: 21
Input:
{
"password": "user_password",
"countrycode": "US",
"type": "12",
"first_name": "",
"last_name": "",
"company_name": ""
}
- email - end-user's email address
- password - end-user's password (a random password fill be generated if no password is given)
- countrycode - end-user's two-characters ISO country code
- type - end-user's account plan - please refer to the API ID column at https://app.vpnwholesaler.com/plans
- first_name - optional - Client's first name
- last_name - optional - Client's last name
- company_name - optional - Client's company name
Response: OVS_NOTIFY_ADD_CLIENT
OVS_NOTIFY_ADD_CLIENT Successful response OVS_ERR_OK data is null
OVS_NOTIFY_ADD_CLIENT Failed response
- OVS_ERR_MISSING_PARAMS
- OVS_ERR_WEB_API
- OVS_ERR_FAILED_ADD_CLIENT data is null
Code sample:
C++
void AddClient(const char* email, const char* password, const char* countrycode, const char* type)
{
json j_obj, j_data_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_ADD_CLIENT;
j_data_obj["email"] = email;
j_data_obj["password"] = password;
j_data_obj["countrycode"] = countrycode;
j_data_obj["type"] = type;
j_obj["data"] = j_data_obj;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}
New product
Add the product to an existing end-user's account on the back-end.
Do not use on New Users: The Add Client endpoint above already creates a product. Therefore, the New Product endpoint is not needed for new users.
Login required: Yes
CmdProc Code: OVS_CMD_NEW_PRODUCT
Command number: 59
Input:
{ "type": "12" }
type - end-user's account plan - please refer to the API ID column at https://app.vpnwholesaler.com/plans
Response: OVS_NOTIFY_NEW_PRODUCT
OVS_NOTIFY_NEW_PRODUCT Successful response OVS_ERR_OK data is null
OVS_NOTIFY_NEW_PRODUCT Failed response
- OVS_ERR_MISSING_PARAMS
- OVS_ERR_WEB_API
data is null
Code sample:
C++
void Newproduct(int type)
{
json j_obj, j_data_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_NEW_PRODUCT;
j_data_obj["type"] = type;
j_obj["data"] = j_data_obj;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}
Close Client
Terminate the end-user's main account immediately, including all products and aliases.
Login required: Yes
CmdProc Code: OVS_CMD_CLOSE_CLIENT
Command number: 22
Input: Not required
Response: OVS_NOTIFY_CLOSE_CLIENT
OVS_NOTIFY_CLOSE_CLIENT Successful response OVS_ERR_OK data is null
OVS_NOTIFY_CLOSE_CLIENT Failed response
- OVS_ERR_MISSING_PARAMS
- OVS_ERR_WEB_API
data is null
Code sample:
C++
void CloseClient()
{
json j_obj, j_data_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_CLOSE_CLIENT;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}
Get Account Type
Returns the end-user's current active plan.
Login required: Yes
CmdProc Code: OVS_CMD_GET_ACCOUNT_TYPE
Command number: 18
Input: Not required
Response: OVS_NOTIFY_GET_ACCOUNT_TYPE
OVS_NOTIFY_GET_ACCOUNT_TYPE Successful response OVS_ERR_OK data will contain
{
"account_type": ""
}
OVS_NOTIFY_GET_ACCOUNT_TYPE Failed response
- OVS_ERR_MISSING_PARAMS
- OVS_ERR_WEB_API
data is null
account_type - client's product name on server
Code sample:
C++
void GetAccountType()
{
json j_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_GET_ACCOUNT_TYPE;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}
Get Account Credentials
Returns the current end-user's OpenVPN Credentials
Login required: Yes
CmdProc Code: OVS_CMD_GET_ACCOUNT_CREDENTIAL
Command number: 19
Input: Not required
Response: OVS_NOTIFY_GET_ACCOUNT_CREDENTIAL
OVS_NOTIFY_GET_ACCOUNT_CREDENTIAL Successful response OVS_ERR_OK data will contain
{
"username": "",
"password": ""
}
OVS_NOTIFY_GET_ACCOUNT_CREDENTIAL Failed response data is null
Code sample:
C++
void GetAccountCredentials()
{
json j_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_GET_ACCOUNT_CREDENTIAL;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}
Get Account Expiration Date
Returns the expiration date for the current end-user's account
Login required: Yes
CmdProc Code: OVS_CMD_GET_ACCOUNT_EXP_DATE
Command number: 20
Input: Not required
Response: OVS_NOTIFY_GET_ACCOUNT_EXP_DATE
OVS_NOTIFY_GET_ACCOUNT_EXP_DATE Successful response OVS_ERR_OK data will contain
{
"exp_date": ""
}
OVS_NOTIFY_GET_ACCOUNT_EXP_DATE Failed response data is null
Code sample:
C++
void GetAccountExpDate()
{
json j_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_GET_ACCOUNT_EXP_DATE;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}
Reset Password
Initiates a password reset request for the specified end-user. If successful, the end-user shall recieve an email with a new password.
Login required: No
CmdProc Code: OVS_CMD_RESET_PASSWORD
Command number: 23
Input:
{
}
Response: OVS_NOTIFY_RESET_PASSWORD
OVS_NOTIFY_RESET_PASSWORD Successful response OVS_ERR_OK
data is null
OVS_NOTIFY_RESET_PASSWORD Failed response data is null
- OVS_ERR_MISSING_PARAMS
- OVS_ERR_WEB_API
Code sample:
C++
void ResetPassword(const char* email)
{
json j_obj, j_data_obj;
char szCmd[1024];
j_obj["cmd"] = OVS_CMD_RESET_PASSWORD;
j_data_obj["email"] = email;
j_obj["data"] = j_data_obj;
snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}